package com.example.computer_exam_training_sys.controller;

import com.example.computer_exam_training_sys.service.UserFavoritesVOService;
import com.example.computer_exam_training_sys.vo.UserFavoriteDetailVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@RequestMapping("/user_favorites_vo")
@CrossOrigin
public class UserFavoritesVOController {
    @Autowired
    private UserFavoritesVOService userFavoritesVOService;

    @GetMapping("/list")
    public List<UserFavoriteDetailVO> getAllUserFavoriteDetails() {
        return userFavoritesVOService.getAllUserFavoriteDetails();
    }

    @GetMapping("/listByUserId/{userId}")
    public List<UserFavoriteDetailVO> getUserFavoriteDetailsByUserId(@PathVariable int userId) {
        return userFavoritesVOService.getUserFavoriteDetailsByUserId(userId);
    }
}
